Method and apparatus for improved flow limitation detection of obstructive sleep apnea

ABSTRACT

In a respiratory apparatus for treatment of sleep apnea and other disorders associated with an obstruction of a patient&#39;s airway and which uses an airflow signal, an obstruction index is generated which detects the flattening of the inspiratory portion of the airflow. The flattening index serves as an obstruction index used to differentiate normal and obstructed breathing. The obstruction index is based upon comparison of values of airflow in different sectors of the inspiratory peak of the wave function and is particularly suitable for distinguishing M shaped or square shaped respiratory patters indicative of partially obstructed airways.

CROSS-REFERENCE TO RELATED APPLICATIONS

The present application is a continuation of U.S. patent applicationSer. No. 12/097,102, filed Oct. 10, 2008, which is a national phaseentry under 35 U.S.C. § 371 of International Application No.PCT/AU2007/000272 filed Mar. 6, 2007, published in English, which claimspriority from U.S. Provisional Patent application No. 60/779,577 filedMar. 6, 2006, all of which are hereby incorporated herein by reference.

FIELD OF THE INVENTION

This invention relates to an improved method and apparatus for thediagnosis and treatment of respiratory conditions including sleep apneaor hypopnea. In particular it relates to detecting either partial orcomplete obstruction of the airway of a patient, based upon an analysisof the time development of an inspiratory portion of a respiratoryairflow curve. It also relates to apparatus that adjust treatmentpressure to be applied by a CPAP ventilator.

BACKGROUND OF THE INVENTION

Obstructive Sleep Apnea (OSA), a syndrome that includes apnea, hypopneaand heavy snoring, causes sleep disruption that brings about serioushealth problems possibly including types of heart disease. OSA is causedby the collapse of portions of a person's airway passage. The treatmentof choice for OSA is the administration of Continuous Positive AirwayPressure (CPAP) to keep the patient's airway open. The air, usually inthe pressure range 4-20 cm H₂O, is supplied by a motor driven blowerwhose output passes via an air delivery device to sealingly engage apatient's airway. A mask, tracheotomy tube, endotracheal tube, nasalpillows or other appropriate device may be used. An exhaust port isprovided in a delivery tube proximate to the air delivery device. SomeCPAP devices, termed bi-level CPAP, sense the breathing cycle ofinspiration and expiration and provide different positive pressurelevels during inhaling and exhaling. Some self-titrating CPAP devicesare designed to determine appropriate pressure levels for the individualpatient by selecting the least pressure that resolves the OSA. In suchdevices patterns of respiratory parameters are monitored to determinewhen OSA is present, and CPAP pressure is raised on the detection ofappropriate patterns to provide increased airway pressure to, ideally,subvert the occurrence of obstructive episodes and the other forms ofbreathing disorder. Such devices are described in U.S. Pat. Nos.5,148,802 and 5,245,995.

Typically a person suffering from OSA is diagnosed and treated in asleep laboratory where the presence of the ailment is confirmed during afirst night sleeping session and the appropriate treatment pressure isdetermined during a second night sleeping session. One problem thatarises is that the appropriate pressure varies during the night as theperson goes through different stages of sleep. Therefore there has beena long felt need for simplified apparatus for use in a patient's ownhome that could determine the presence of OSA and modify the pressurelevel to an optimum pressure. There have been several attempts, withvarying success, to determine the presence of OSA from the analysis ofthe shape of airflow curves as a function of time.

The monitoring of upper airway pressure-flow relationships inobstructive sleep apnea has been described in Smith et al., 1988, J.Appl Physiol. 64: 789-795. FIG. 1 of that article shows polygraphicsleep recordings at varying levels of increasing nasal pressure. It wasnoted that inspiratory volumetric flow plateaued in certain breathssuggesting the presence of airflow limitation. Pressure-flow curves wereconstructed by plotting mid-inspiratory airflow against either maskpressure or endoesophageal pressure. The pressure-flow plots of nasalpressure against mean midinspiratory flow were then fit by least-squareslinear regression to calculate resistance upstream to thecollapsible-site.

The effect of positive nasal pressure on upper airway pressure-flowrelationships has been described in Schwartz et al., 1989, J. ApplPhysiol. 66: 1626-1634. FIG. 4 of the article shows that pressure-flowtracings plateau at a low pressure level. It was further shown when thepressure was increased, flow did not plateau.

U.S. Pat. No. 5,335,654 (Rapoport) shows the effect of CPAP on theairflow versus time curve for a patient suffering from OSA. FIGS. 1-5 inRapoport show that as the pressure is reduced from 10 cm H₂O to 2 cm H₂Oin steps of 2 cm H₂O the curve of airflow versus time changes from analmost smooth sinusoidal pattern to one with a flattening of theinspiration portion of the curve with initial and terminal flow spikes.At 2 cm H₂O the curve has developed a so-called M shape (i.e. with aripple in the middle) and has also developed overshoots (i.e. peaks) ateach end of the flattened central region. In an attempt to characterizethe flow shapes that indicate obstruction, Rapoport lists severalindices said to be indications of flow limitation and/or partialobstruction patterns including: (1) The derivative of the flow signalequals zero; (2) The second derivative between peaks of the flow signalis zero for a prolonged interval; (3) The ratio of early inspirationalflow to mid-inspirational flow is less than or equal to 1. The patentfurther lists events said to be indications of obstructions: (1) Reducedslope of the line connecting the peak inspiratory flow to the peakexpiratory flow; (2) Steep upward or downward stroke (dV/dt) of the flowsignal; and (3) Ratio of inspiratory flow to expiratory flow over 0.5.

With regard to the control of CPAP treatment, various techniques areknown for sensing and detecting abnormal breathing patterns indicativeof obstruction. For example, U.S. Pat. No. 5,245,995 (Sullivan et al.)describes how snoring and abnormal breathing patterns can be detected byinspiration and expiration pressure measurements while sleeping, therebyleading to early indication of pre-obstructive episodes or other formsof breathing disorder. Particularly, patterns of respiratory parametersare monitored, and CPAP pressure is raised on the detection ofpre-defined patterns to provide increased airway pressure to ideallyprevent the occurrence of the obstructive episodes and the other formsof breathing disorder.

U.S. Pat. No. 5,645,053 (Remmers) describes calculating a flatnessindex, wherein flatness is defined to be the relative deviation of theobserved airflow from the mean airflow. In Remmers, individual values ofairflow are obtained between 40% and 80% of the inspiratory period. Themean value is calculated and subtracted from individual values ofinspiratory flow. The individual differences are squared and divided bythe total number of observations minus one. The square root of thisresult is used to determine a relative variation. The relative variationis divided by the mean inspiratory airflow to give a relative deviationor a coefficient of variation for that breath.

U.S. Pat. No. 5,704,345 (Berthon-Jones) disclosed a method for detectingpartial obstruction of a patient's airway by calculating two obstructionindex values that parameterize a flattening of an inspiratory portion ofa patient's monitored respiratory airflow. Either obstruction index isthen compared to a threshold value. The first shape factor involves aratio of the mean of a mid-portion of the inspiratory airflow of thebreathing cycle and the mean of the inspiratory airflow.

${{shape}\; 1} = \frac{\frac{1}{33}{\sum\limits_{t = 16}^{48}{{fs}(t)}}}{M}$

where fs(t) is a sample of the patient inspiratory airflow and M is themean of inspiratory airflow given by

$M = {\frac{1}{65}{\sum\limits_{t = 1}^{65}{{{fs}(t)}.}}}$

The second shape factor involves a ratio of the Root Mean Squaredeviation of a mid-portion of inspiratory airflow and the meaninspiratory airflow according to the formula

${{shape}\; 2} = {\frac{\sqrt{\frac{1}{33}{\sum\limits_{t = 16}^{48}\left( {{{fs}(t)} - M} \right)^{2}}}}{M}.}$

U.S. Pat. No. 6,814,073 (Wickham) discloses a method and apparatus fordetecting some forms of obstruction based upon the inspiratory airflow.In this method, inspiratory airflow samples corresponding tomid-inspiration are identified. In one embodiment, weighting factors areapplied based on whether the inspiratory airflow samples are less thanor greater than a threshold level, such as the mean airflow. In anotherembodiment, different weighting factors are applied to samples based ontheir time positions in a breath. Samples taken prior to a certain eventduring inspiration, for example samples preceding the half way point ofinspiration, are assigned lower weighting factors than samplessucceeding the event. An obstruction index is then calculated usingthese samples with their corresponding weighting factors.

All these disclosed techniques fail to detect flow limitation in certaintypes of flow patterns, particularly the M-wave pattern. More generally,flow limitation in the inspiratory patterns that present with leading orlagging overshoot, is not appropriately detected. The detectabilitydepends on two factors. 1) the extent to which the overshoot-traversesthe mid-portion of the inspiratory airflow, and 2). the size of theovershoot. The solution presented by Wickham, works satisfactorily ifthe size of the overshoot is relatively small, does not span a largeportion of mid-inspiration, and is not present in the latter half of theinspiratory airflow.

However, flattening indices from the Wickham method are sometimes not asaccurate as the indices from the method disclosed by Berthon-Jones. Oneaspect of the present invention is to simplify the algorithm mentionedin U.S. Pat. No. 5,704,345 (Berthon-Jones), the disclosure of which isincorporated by reference. Thus, an objective of the current inventionis to present a method by which flow-limitation can be detected in thepresence of the mentioned limitations, particularly the M wave patternwith overshoots.

The flow limitation detection/estimation technique described by theprior art is also expensive in terms of digital processing power, andthe accuracy of flow detection required. Therefore its utility in lowcost electronic/software platforms is limited. Therefore anotherobjective of the present invention is to simplify the algorithm torender it more amenable to low-end electronic and software platforms.

BRIEF SUMMARY OF THE INVENTION

The present invention involves an improved method and apparatus fordetecting some forms of respiration obstruction based upon theflattening of the inspiratory airflow.

One aspect of the invention is a method for detecting partialobstruction of the airway of a patient, the method comprising the stepsof Measuring respiratory air flow from the patient; Detecting theinspiratory part of that airflow; Trimming the inspiratory part toremove any expiratory pause; Normalizing the effect of offshoot; Scalingthe inspiratory flow to a reference value; Calculating the meandeviation of a central portion of the inspiratory air flow; Calculatinga flattening index from the mean deviation; and Filtering the flatteningindex with a moving average filter.

In connection with the method for detecting partial obstructions, anormalizing correction is made for overshoots that would otherwiseexaggerate the roundness estimate of the inspiratory airflow.

In an embodiment of the invention the normalization of the overshoot isaccomplished by truncating airflow values outside a central portion ofthe inspiratory airflow that exceed the average value of a centralportion of the inspiratory airflow.

In another embodiment of the invention, the overshoot is evaluated bydividing the inspiratory airflow wave into multiple parts, calculatingmean amplitudes for each part, analyzing the mean amplitudes todetermine the presence of overshoot, and, if overshot is indicated,treating flattening as low.

In a further embodiment of the invention, a hunt for maximal flatness iscarried out by calculating a set of flattening indices for each possiblesample in a middle part of the inspiratory wave form and taking theflattening index for the inspiratory waveform to be the minimum of thecalculated indices.

Hence it is an aspect of the invention to estimate the extent of flowlimitation in patient breath by the extent to which the position of peakflow deviates from the center of the inspiration flow curve.

It is a further aspect of the invention to estimate the flow limitationby the extent to which the relative mean amplitude of different parts ofthe breath deviate from the pattern exhibited by normal breaths.

It is a still further aspect of the invention to provide a method toestimate the extent of flow limitation by hunting for the part of thebreath that exhibits maximal flatness.

It is an objective of the present invention to provide an apparatus inwhich obstruction, either partial or complete, of the patient's airwayis detected by analyzing respiratory airflow by a method for detectingpartial obstruction of the airway of a patient, the method comprisingthe steps of Measuring respiratory air flow from the patient; Detectingthe inspiratory part of that airflow; Trimming the inspiratory part toremove any expiratory pause; Normalizing the effect of offshoot; Scalingthe inspiratory flow to a reference value; Calculating the meandeviation of a central portion of the inspiratory air flow; Calculatinga flattening index from the mean deviation; and Filtering the flatteningindex with a moving average filter.

A further objective is to provide an apparatus in which an improvedalgorithm for detecting airway obstruction is implemented without usingadditional components or making substantial changes to the structure ofexisting respiratory apparatus.

Accordingly, a respiratory apparatus is provided in which therespiratory airflow of a patient is continuously monitored and the partof respiratory airflow associated with inspiration is identified andsampled.

In one aspect, the subject invention pertains to a respiratory apparatuswhich includes an air source adapted to selectively provide pressurizedbreathable air to a patient, a flow detecting device to sense therespiratory airflow from the patient and to generate an airflow signalindicative of airflow, an obstruction detector coupled to said flowsensor which implements a method for detecting partial obstruction ofthe airway of a patient, the method comprising the steps of Measuringrespiratory air flow from the patient; Detecting the inspiratory part ofthat airflow; Trimming the inspiratory part to remove any expiratorypause; Normalizing the effect of offshoot; Scaling the inspiratory flowto a reference value; Calculating the mean deviation of a centralportion of the inspiratory air flow; Calculating a flattening index fromthe mean deviation; and Filtering the flattening index with a movingaverage filter, and a pressure controller connected to a pressure sensorequivalent—either physically or logically arranged to control theoperation of the air source, receive the obstruction signal and alterthe operation of the air source in response to the obstruction signal.The term flow detecting device is intended to be a general term thatincludes flow sensors or alternative flow detecting devices oralgorithms, such as, for example, those determining flow from a motorcurrent.

Another aspect of the invention concerns an apparatus for monitoringand/or treating a patient having a sleep disorder, the apparatusincluding a flow detecting device that senses patient respiration andgenerates a corresponding flow signal; and an obstruction detectorcoupled to the flow detecting device and adapted to implement a methodfor detecting partial obstruction of the airway of a patient, the methodcomprising the steps of Measuring respiratory air flow from the patient;Detecting the inspiratory part of that airflow; Trimming the inspiratorypart to remove any expiratory pause; Normalizing the effect of offshoot;Scaling the inspiratory flow to a reference value; Calculating the meandeviation of a central portion of the inspiratory air flow; Calculatinga flattening index from the mean deviation; and Filtering the flatteningindex with a moving average filter, wherein the obstruction detectorincluding a signal generator that generates a signal indicative of anairway obstruction based on the flattening index.

A further-aspect of the invention concerns an apparatus for treating apatient having a sleep disorder, the apparatus comprising a mask, a gassource selectively supplying pressurized breathable air to the patientthrough the mask, a flow detecting device that senses airflow andgenerates a flow signal indicative of respiration, an obstructiondetector coupled to the flow detecting device and adapted to implement amethod for detecting partial obstruction of the airway of a patient, themethod comprising the steps of Measuring respiratory air flow from thepatient; Detecting the inspiratory part of that airflow; Trimming theinspiratory part to remove any expiratory pause, Normalizing the effectof offshoot, Scaling the inspiratory flow to a reference value,Calculating the mean deviation of a central portion of the inspiratoryair flow, Calculating a flattening index from the mean deviation, andFiltering the flattening index with a moving average filter, and acontroller receiving the obstruction signal and generating in response acommand for activating the gas source.

Another aspect of the invention concerns a method for detectingobstruction in the airways of a patient, including measuring an air flowof the patient; detecting a predetermined section of said air flow,implementing a method for detecting partial obstruction of the airway ofa patient, the method comprising the steps of Measuring respiratory airflow from the patient; Detecting the inspiratory part of that airflow;Trimming the inspiratory part to remove any expiratory pause;Normalizing the effect of offshoot; Scaling the inspiratory flow to areference value; Calculating the mean deviation of a central portion ofthe inspiratory air flow; Calculating a flattening index from the meandeviation; and Filtering the flattening index with a moving averagefilter.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 shows a block diagram of a respiratory apparatus constructed inaccordance with this invention;

FIG. 2 shows a flow chart illustrating the operation of the apparatus ofFIG. 1;

FIG. 3 shows the inspiration phases of typical respiration signals for ahealthy person and a person with a partial airway obstruction;

FIG. 4 shows a normal respiratory cycle.

FIG. 5 shows normal and flow limited flow vs. time curves. The left handpanel shows a normal curve. The right hand panels show flow limitedcurves.

FIG. 6 shows inspiratory flow vs. time for two possible breaths.

FIG. 7 is a graph of basis vectors for use in calculating an M shapeindex.

FIG. 8 is a graph of a typical M shaped breath.

DETAILED DESCRIPTION

Apparatus and Methodology

FIG. 1 shows an example respiratory apparatus 10 constructed inaccordance with the invention. The respiratory apparatus 10 includes amask 12 connected to a blower 14 by a flexible tube 16. The mask 12 isfitted to the patient and may be either a nose mask or a facemask. Theblower 14 has an air outlet 22 is driven by a motor 18 in accordancewith control signals from a servocontroller 20. This arrangement allowsthe respiratory apparatus 10 to deliver pressurized air (or air enrichedwith oxygen from a source, not shown). The pressurized air is deliveredby tube 16 to the mask 12. The tube 16 is provided with a narrow exhaustport 26 through which air exhaled by the patient is expelled.

A control circuit 24 is used to control the operation of servocontroller20 and motor 18 using certain predetermined criteria, thereby definingmodes of operation for the apparatus 10. Preferably, in accordance withthis invention, the control circuit 24 is adapted to operate theapparatus 10 to provide CPAP to the patient.

Control circuit 24 includes a flow restrictive element 28. Tubes 30 and31 lead from different sides of the restrictive element 28 to a maskpressure transducer 32 and a differential pressure transducer 34respectively. The mask pressure transducer 32 is also connected throughanother tube 33 to the differential pressure transducer 34.

The mask pressure transducer 32 generates a first electrical signal,which is amplified by an amplifier 36 to generate an output P(t)proportional to the air pressure within the mask 12. This output is feddirectly to the servocontroller 20.

The differential pressure transducer 34 senses the differential pressureacross the flow restrictive element 28, which differential pressure isrelated to the airflow rate through the flow restrictive element 28 andtube 16.

Differential pressure transducer 34 generates a second electrical signalthat is amplified by an amplifier 38. This amplified signal F(t) istermed an airflow signal since it represents the airflow through thetube 16. Alternatively, the flow may be derived from the motor current.

The airflow signal F(t) is fed to a filter 40 that filters the signalwithin a preset range. The outputs of the filter 40 and amplifier 36 arefed to an ADC (analog-to-digital) converter 42, which generatescorresponding signals to a microprocessor 44. The microprocessor 44generates analog control signals that are converted into correspondingdigital control signals by DAC 46 and used as a reference signal Pset(t) for the servo 20.

One method for the operation of a respiratory apparatus 10 is shown inthe flow chart of FIG. 2. Individuals skilled in the art will recognizeother methodologies for utilizing the improved flow flattening indexthat is disclosed herein. The embodiment of the methodology of FIG. 2 isalso detailed in U.S. Pat. No. 5,704,345 (the '345 patent). The firststep 100 is the measurement of respiratory flow over time. Thisinformation is processed in step 102 to generate Index values to be usedas qualitative measures for subsequent processing. Thus, Step 102includes the generation of obstruction index values based upon theaveraging method as disclosed herein. Step 104 detects whether an apneais occurring by comparison of the breathing Index with a thresholdvalue.

If the answer in step 104 is “Yes”, an apnea is in progress and therethen follows a determination of patency in step 110 by methods disclosedin the mentioned Wickham or Berthon-Jones patents. If there is patencyof the airway, a central apnea with an open airway is occurring, and, ifdesired, the event is logged in step 112. If the result of step 110 isthat the airway is not patent, then a total obstructive apnea or acentral apnea with closed airway is occurring, which results in thecommencement or increase in CPAP treatment pressure in step 108. Ifdesired, step 108 may include the optional logging of the detectedabnormality. Alternatively, flattening is simply rejected when apneaoccurs since the breath pattern will not satisfy the criteria of eitherthe number of samples or the required tidal volume—that is required fora valid breath for flattening—when apnea is present.

If the answer in step 104 is “No”, one or more obstruction indices, suchas the improved flow flattening indices, are compared with thresholdvalues in step 106, by which the determination of obstruction of theairway is obtained. If the answer is “Yes” in step 106, then there is apartial obstruction, and if “No”, there is no obstruction (normalcy).

In the case of a complete or partial obstruction of the airway Step 108applies and a consequential increase in CPAP treatment pressure occurs.In the instance of normal breathing with no obstruction, the CPAPtreatment pressure is reduced, in accordance with usual methodologiesthat seek to set the minimal pressure required to obviate, or at leastreduce, the occurrence of apneas. The amount of reduction in step 107may, if desired, be zero. Similarly, in the event of a central apneawith patent airway (step 110,112) treatment pressure is not increased.Such increases in pressure reflexively inhibit breathing, furtheraggravating the breathing disorder.

Improved Flow Flattening Indices

FIG. 3 depicts an airflow signal with respect to the inspiratory portionof a typical breathing cycle. During the inspiratory portion of thebreathing cycle of a healthy person (solid line), the airflow risessmoothly with inspiration, reaches a peak and falls smoothly to zero.However, a patient with a partially obstructed airway (dashed line)exhibits a breathing pattern characterized by a significant flat zoneduring inspiration. Theoretically, for an obstructed flow, as the degreeof partial obstruction increases, the airflow signal for inspirationwould tend to a square wave.

Detection of Inspiratory and Expiratory Half Cycles in Breathing

As shown in FIG. 4, a normal respiratory cycle consists of inspirationand expiration and a brief end-expiratory pause. During theend-expiratory pause small oscillations in airflow due to heartbeatoccur. In order to correctly detect the start of inspiration, it isnecessary to ignore the small pulses of air due to heartbeat. Similarlyit is necessary to ignore brief cessation due to swallowing.

The start of inspiration may be taken provisionally as the time thatinspiratory airflow exceeds a threshold of about 0.05 L/sec. If the flowthen falls below zero again before the total volume reaches about 0.1liters, it is assumed that expiration is continuing.

The start of expiration is taken provisionally as the time thatexpiratory airflow falls below zero. If the airflow then goes aboveabout 0.05 L/sec in the inspiratory direction before the total volumeexpired reaches about 0.1 liters, it is assumed that inspiration iscontinuing.

The purpose of the above algorithm is to detect the start and end ofeach respiratory half-cycle. This information is required for the shapedetector. It is immune to events such as swallows and cardiogenicairflow (which do not achieve the 0.1 litre volume requirement). Anormal breath has a peak flow of about 0.3 L/sec, and a tidal volume of0.5 liters. Hence there is a 3 to 5-fold reserve ability to detectnormal breaths. Since the timing information is used for shapealgorithms, where very small breaths are irrelevant, it is not necessaryto respond to extremely small breaths. Because the threshold crossingpoint is detected without further low pass filtering, the algorithm doesnot introduce phase delay.

Calculation of Curvature or Flattening Index

A normal inspiratory flow-time curve is rounded, or quasi-sinusoidal inshape. Diaphragm muscular effort available for producing airflow is lowat the beginning and end of the breath, and high in the middle of thebreath. With adequate CPAP pressure the airway is acting essentially asa rigid tube, and flow is a function of effort: increasing effortproduces increasing flow.

If the CPAP pressure is adequate to prevent apnoeas and snoring, but notadequate to achieve full patency, the airway now behaves like a floppyelastic tube, and increasing effort causes increasingly subatmosphericpressure, leading to progressive narrowing of the airway. Above acertain threshold effort, the airway narrows: the increased narrowingexactly compensates for the increasing effort, so flow becomes constant,independent of effort. Therefore the flow-vs-time curve will approximatea square wave as shown in the middle panel of FIG. 5.

In practice, if effort is only above the threshold flattening behaviorduring the middle part of the breath where effort is maximal, theflattening will be most noticeable over the middle half of theinspiration. Conversely, if effort is very high, inertial effects canlead to a brief period of high flow early in the breath, causing theinitial overshoot shown in the right hand frame of FIG. 5. Hence, thepresent algorithm looks specifically at the middle half of theinspiration, not at the entire breath.

In FIG. 5, the inspiratory flow-vs.-time curve is scaled to unitduration and area. RMS deviation from unit flow is then calculated overthe middle 50% of inspiratory time. The left hand panel shows a normalcurve, where the RMS deviation is large, and the right hand panels showflow limited curves, with a small RMS deviation.

A curvature or flattening index is derived, in order to quantify thedegree of mid inspiratory flattening of the flow-time curve, using thefollowing steps:

1. Referring to FIG. 6, any end-expiratory pause that has been includedin the inspiratory half cycle is trimmed off as follows: Find where flowfirst reaches 75% of peak inspiratory flow “a”, search backwards to thepoint where the flow last reached 25% of the peak “b”, and extrapolatebackwards to locate the time at which ray “ab” reaches the x-axis, i.e.to find the time where flow should be zero “c”. This is taken as theearliest time at which inspiration could have started. In addition if“c” is to the left of origin “d”, use origin “d”.

2. The approximate effect of a 0.1 Hz low pass filter on the flow-timecurve may be calculated and reversed as follows: (a) Pass the wavethrough an identical 0.1 Hz low pass filter a second time. (b) Subtractthe doubly filtered wave from the singly filtered wave to give afirst-order approximation of the effect of the filter. (c) Add thisdifference back to the original wave. Alternatively, this compensationfor leak filter may be expected not to alter-the results significantlyand may therefore be removed for computation efficiency.

For breaths of interest, inspiratory duration is about seconds. The 0.1Hz filter produces some distortion of the wave shape. For example, thetrailing edge of a 2 second square wave sags by 20% of its amplitude,and the area under the curve is reduced by 10%. After correction, thetrailing edge sags by only 2% of its amplitude, and the area under thecurve is correct to 0.7%. The filter reduces the area under a sine waveby 10%, and after correction, the area is correct to 0.6%. This is morethan adequate for our current purposes.

3. The effect of overshoot is normalized as will be described below.

4. The inspiratory flow-time curve is scaled to unit length and unitmean height. The scaling is because we are interested in the shape ofthe flow-time curve (rounded vs. flattened), not its amplitude orduration. Even with correct CPAP pressure, amplitude and duration arevery variable, (particularly in REM sleep but also in stage 1 sleep andawake with sighs etc). Therefore, length and amplitude convey noimportant information about the adequacy of the CPAP pressure.

5. Breaths with grossly abnormal shapes are detected by comparing with atemplate.

Breaths that differ from the template by more than a threshold value atany point over the middle half are rejected. The default threshold is1.0 unit.

6. The mean deviation of the inspiratory wave from the referenceamplitude (M), for a middle portion of the wave is calculated. Forexample if the middle portion is one quarter of the inhalation wave andis centered then the mean deviation is:

${MeanDeviation} = \frac{\sum\limits_{t = 24}^{40}\left( {{{fs}(t)} - M} \right)}{16}$

7. The Flattening Index (FI) is calculated as

${F\; I} = {\frac{MeanDeviation}{M}.}$

Typical values of the Flattening index for actual patients gives ˜0.21for normal curves; 0.15 is a threshold below which the device shouldincrease the CPAP pressure.

8. If the breath is not rejected, a multiple breath pointwise movingaverage flow-time curve is updated, for example a 5 breath average.

The purpose of step 8 (averaging the waveform over 5 breaths) is toreduce the effect of cardiogenic airflow, which could disguise anotherwise flattened flow-time curve. Swallows, coughs, talking, etc canproduce very abnormally shaped breaths. The purpose of step 5 is toprevent such breaths being included in the 5 breath average, which woulddelay the recognition of genuine flow limitation.

Step 8 may be unnecessary, because during flow limitation, cardiogenicpressure oscillations may not cause important changes in flow rate, dueto effort independence. If this is the case, step 5 is also unnecessary,because coughs, swallows, etc will not be flat over the middle half ofinspiration, and will therefore be correctly classified as notflow-limited.

Step 3, the normalization of overshoot, may be accomplished in severalembodiments. This aspect of the invention assumes that 1) peak flowoccurs close to middle portion of the wave, 2) the first 3^(rd) of thewave should have a generally positive gradient 3) the last third agenerally negative gradient. 4) Any deviation from these conditionswould indicate an overshoot.

In one embodiment the method comprises of 1) estimating peak flow in amiddle portion of the wave, for example the middle third of the wave 2)any point outside that portion, for example in the first and/or lastthird of the said wave that exceeds the said peak flow is reset to thepeak flow. This method therefore reduces the impact of the overshoot.

In a second embodiment the method comprises 1) estimating peak flow inthe middle portion (e.g. a third) of the wave 2) any point outside thatportion (e.g. in the first and/or last third of the said wave) thatexceeds the peak flow is reset to the average of the sample before andafter. 3) The process continues until no sample in the outside portionsis greater than the peak flow. This method again reduces the impact ofthe overshoot—while also maintaining the shape of the waveform.

In a third (preferred) embodiment the method consists of 1) Dividing thewave into n parts and calculate mean amplitudes for each part. 2) Applylogic to determine what sort of wave the pattern indicates. 3) Ifovershoot is indicated, mark flattening as low.

In a fourth embodiment the method consists of 1) Calculating estimate offlattening for every n samples in the middle half of the wave (e.g.calculate flattening for sample 16 . . . 24, 17 . . . 25, and so on). 2)Marking the flattening index as the value that corresponds to the lowestvalue obtained for all sample permutations.

Alternative Statistical Calculation for M-Shape Detection

An alternative embodiment of the invention uses a different measure todetermine whether an inspiratory wave pattern has an M shape. Thetechnique is to decompose the inspiratory wave into a vector of features(floating point numbers) and a matrix pair of basis vectors that areorthogonal. Normalizing the time interval so that inspiration begins atzero and ends at B radians, the basis vectors may be chosen to be sin(Bt) and sin (3Bt). The inspiratory waveform is thus fit to the curve asin (Bt)+b sin(3Bt), where a and b are determined by fitting the basisvectors to the inspiratory waveform in a least-squares sense usingsingular value decomposition. This is equivalent to finding thepseudo-inverse of the basis matrix and then multiplying the inspiratorywaveform by this pseudo-inverse to find the factors. The pseudo-inversecan be calculated offline, i.e. not by the CPU contained in theventilator.

To reduce the amount of calculation involved in this statisticalcalculation it is possible to map the [a,b] space for many patients andnote the clusters into which the points representing the individualpatients fall. The M-shaped breaths will be found clustered away fromthe non-M-shaped breaths. Thus whether a breath is M shaped can bedetermined by the Euclidean measure of distance from the M clustercenter.

Example of M Shape Index Calculation

Each inspiration is interpolated over a grid of N points, preferablyN=65. Two basis functions as shown in FIG. 7 are calculated fort=i/(N−1) where i goes from 0 to N−1, as

B1=sin(πt)

B2=sin(3πt)

These basis functions can then be stored for use with all subsequentcalculations of the M-shaped feature.

Each inspiration is then extracted and interpolated over a grid of Npoints. Two factors are then calculated as:

F ₁=sum(B1·fs)

-   -   where fs represents the interpolated inspiration points and ⋅        the dot-product operator.

The final shape value is obtained by normalising as:

${{shape}\mspace{20mu} {index}} = \frac{F_{2}}{\sqrt{F_{1}^{2} + F_{2}^{2}}}$

This shape factor is then limited to vary between zero (purelysinusoidal) to one (very M-shaped).

For a typical M-shaped breath, as shown in FIG. 8, the abovecalculations yield

F1=4.6082

F2=2.6538

-   -   and shape index=0.50. This may be contrasted with a typical        non-flow limited breath that has an M-shape index of only about        0.2.

Although the invention has been described with reference to a particularembodiment, it is to be understood that this embodiment is merelyillustrative of the application the principles of the invention. Thus,it is to be understood that numerous modifications may be made in theillustrative embodiment of the invention and other arrangements may bedevised without departing from the spirit and scope of the invention.For example, while the preferred embodiment of the invention divides thewaveform into specific segments for analysis and concentrates on thecentral values, other divisions and off center regions might equallyapply.

1. A method for the detection of inspiratory and expiratory half cyclesin breathing comprising detecting the start of inspiration,provisionally taking the start of inspiration as the time thatinspiratory airflow exceeds a predetermined threshold, rejecting thestart of inspiration if the flow then falls below zero again before thetotal volume reaches a predetermined value, provisionally taking thestart of expiration as the time that expiratory airflow falls belowzero, rejecting the start of expiration if the airflow then goes above apredetermined value in the inspiratory direction before the total volumeexpired reaches a predetermined value.
 2. The method of claim 1 furthercomprising trimming any end-expiratory pause that has been included inthe inspiratory half cycle.
 3. The method of claim 1 further comprisingfinding the earliest time at which inspiration could have started bylocating the time where flow first reaches a predetermined percentage ofpeak inspiratory flow, searching backwards to the time where the flowlast reached a second predetermined percentage of the peak, andextrapolating backwards to find the time where flow should be zero. 4.The method of claim 1 further comprising reversing the approximateeffect of a low pass filter on the flow-time curve by the steps of (a)passing the wave through an identical low pass filter a second time, (b)subtracting the doubly filtered wave from the singly filtered wave togive a first-order approximation of the effect of the filter, and (c)adding this difference back to the original wave.
 5. The method of claim1 further comprising normalizing the effect of overshoot by scaling theinspiratory flow-time curve to unit length and unit mean height.
 6. Themethod of claim 1 further comprising calculating the mean deviation ofthe inspiratory wave from the reference amplitude (M), for a middleportion of the wave.
 7. The method of claim 1 where the middle portionis one quarter of the inhalation wave and is centered then the meandeviation further comprising determining the mean deviation by theformula${MeanDeviation} = \frac{\sum\limits_{t = 24}^{40}\left( {{{fs}(t)} - M} \right)}{16}$8. The method of claim 7 further comprising determining a flatteningIndex (FI) as ${F\; I} = {\frac{MeanDeviation}{M}.}$
 9. The method ofclaim 1 further comprising updating a multiple breath pointwise movingaverage flow-time curve.
 10. The method of claim 1 further comprisingreducing the impact of the overshoot by estimating peak flow in a middleportion of the wave, resetting to the peak flow each point outside aportion that exceeds said peak flow.
 11. The method of claim 10 furthercomprising reducing the impact of the overshoot by continuing theprocess until the magnitude of no sample in the outside portions isgreater than the peak flow.
 12. The method of claim 1 further comprisingdividing the wave into n parts and calculate mean amplitudes for eachpart, determining what sort of wave the pattern indicates and ifovershoot is indicated, mark flattening as low.
 13. The method of claim1 further comprising calculating an estimate of flattening for every nsamples in the middle half of the wave marking the flattening index asthe value that corresponds to the lowest value obtained for all samplepermutations.
 14. The method of claim 1 further comprising determiningwhether an inspiratory wave pattern has an M shape by the steps of:decomposing the inspiratory wave into a vector of features and a matrixpair of basis vectors that are orthogonal, normalizing the time intervalso that inspiration begins at zero and ends at B radians finding thepseudo-inverse of the basis matrix and multiplying the inspiratorywaveform by this pseudo-inverse to find the factors.
 15. The method ofclaim 14 further comprising mapping a linear space for many patients andnoting the clusters into which the points representing the individualpatients fall and determining whether a breath is M shaped by theEuclidean measure of distance from an M cluster center.